package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.OnPostForumListener;

/**
 * author : 许建宏
 * Date: 2017/12/8 0008
 * View: 社区
 */

public class ForumPresenter {

    private RequestModel requestModel;
    private OnPostForumListener onPostForumListener;

    public ForumPresenter(OnPostForumListener onPostForumListener) {
        this.requestModel = new RequestModel();
        this.onPostForumListener = onPostForumListener;
    }

    //发帖
    public void postForumData(String content,String cover){
        requestModel.PublicPostInfoData(content, cover, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                onPostForumListener.onPostSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onPostForumListener.onPostError(msg);
            }

            @Override
            public void onRefreshUI() {
                onPostForumListener.onPostRefreshUI();
            }
        });

    }
}
